<template>
  <div style="margin-bottom: 60rem">
    <div class="top">
      <div class="topleft">
        <h1>猫眼电影</h1>
      </div>
      <div class="topright">
        <span>
          <svg
            t="1675308255124"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="32482"
            width="20"
            height="20"
          >
            <path
              d="M892.928 128q28.672 0 48.64 19.968t19.968 48.64l0 52.224q0 28.672-19.968 48.64t-48.64 19.968l-759.808 0q-28.672 0-48.64-19.968t-19.968-48.64l0-52.224q0-28.672 19.968-48.64t48.64-19.968l759.808 0zM892.928 448.512q28.672 0 48.64 19.968t19.968 48.64l0 52.224q0 28.672-19.968 48.64t-48.64 19.968l-759.808 0q-28.672 0-48.64-19.968t-19.968-48.64l0-52.224q0-28.672 19.968-48.64t48.64-19.968l759.808 0zM892.928 769.024q28.672 0 48.64 19.968t19.968 48.64l0 52.224q0 28.672-19.968 48.64t-48.64 19.968l-759.808 0q-28.672 0-48.64-19.968t-19.968-48.64l0-52.224q0-28.672 19.968-48.64t48.64-19.968l759.808 0z"
              p-id="32483"
              fill="#e6e6e6"
            ></path>
          </svg>
        </span>
      </div>
    </div>
    <div class="design">
      <div class="designleft">
        <img src="../../img/logo3x.png" alt="" />
      </div>
      <div class="designright">
        <span>发现最新最热电影&nbsp;&nbsp;<b style="color: #f5f5f5">|</b></span>
        <b>打开APP></b>
      </div>
    </div>
    <div class="nav">
      <div class="weizhi" @click="$router.push({ path: '/position'})">
        <p>{{ cityName }}</p>
        <span>▼</span>
      </div>
      <div class="luyou">
        <RouterLink to="/">热映</RouterLink>
        <RouterLink to="/ying">影院</RouterLink>
        <RouterLink to="/dai">待映</RouterLink>
        <RouterLink to="/sutra">经典电影</RouterLink>
      </div>
      <div class="search" @click="$router.push({ path: '/search'})">
        <span>
          <svg
            t="1675315582976"
            class="icon"
            viewBox="0 0 1024 1024"
            version="1.1"
            xmlns="http://www.w3.org/2000/svg"
            p-id="33651"
            width="20"
            height="20"
          >
            <path
              d="M1005.312 914.752l-198.528-198.464A448 448 0 1 0 0 448a448 448 0 0 0 716.288 358.784l198.4 198.4a64 64 0 1 0 90.624-90.432zM448 767.936A320 320 0 1 1 448 128a320 320 0 0 1 0 640z"
              fill="#f03d37"
              p-id="33652"
            ></path>
          </svg>
        </span>
      </div>
    </div>
    <RouterView />

  </div>
</template>

<script setup>
import axios from "@/api/axios.js";
import { ref } from "vue";

const myData= localStorage.getItem('cityId') || 'default value'
// console.log(myData);
const cityName= localStorage.getItem('cityName') || 'default value'
// console.log(cityName);


const getCity = () => axios.get("api/dianying/cities.json", {});
const city = ref([]);

async function update() {
  const { data } = await getCity();
  city.value = data;
  // console.log("city", city);
  return city;
}
update();

</script>

<style lang="scss" scoped>
a {
  text-decoration: none;
}
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  width: 100vw;
  height: 8vh;
  color: #ddd;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  background-color: #e54847;
  .topleft {
    width: 100vw;
    font-size: 20rem;
    line-height: 8vh;
    display: flex;
    justify-content: center;
  }
  .topright {
    display: flex;
    align-items: center;
    margin-right: 10rem;
  }
}
.design {
  width: 100vw;
  height: 8vh;
  background-color: #fff;
  justify-content: space-between;
  display: flex;
  border-bottom: 1px solid #ddd;
  .designleft {
    width: 93px;
    height: 39px;
    margin: auto 0;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .designright {
    font-size: 13rem;
    font-weight: 620;
    color: #666;
    display: flex;
    align-items: center;
    b {
      font-size: 16rem;
      margin-left: 2rem;
      color: #b37e7e;
    }
  }
}
.nav {
  position: fixed;
  top: 8vh;
  left: 0;
  right: 0;
  background-color: #fff;
  z-index: 99;
  display: flex;
  justify-content: space-around;
  border-bottom: 2rem solid #ddd;
  .weizhi {
    display: flex;
    line-height: 7vh;
    font-size: 12px;
    font-weight: 200;
    color: #8d878c;
    p {
      font-size: 16px;
    }
  }
  .search {
    margin: auto 0;
  }
}

.luyou {
  height: 7vh;
  line-height: 7vh;
  display: flex;
  justify-content: center;
  a {
    font-size: 18px;
    font-weight: 600;
    color: #666666;
    padding-bottom: 5px;
    margin-right: 10rem;
  }
  a.router-link-exact-active {
    color: #000;
    font-size: 19px;
    font-weight: bold;
    border-bottom: 2rem solid #f03d37;
  }
}
</style>
